﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PopupRelativeEvent.aspx.cs" Inherits="MTRC.ODMS.Web.SOM.Popup.PopupRelativeEvent" %>

<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>无标题页</title>
    <base target="_self" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <link href="../../CSS/common.css" rel="stylesheet" type="text/css" />

    <script language="JavaScript" src="../../Javascript/CommonFunction.js"></script>

    <script language="javascript">
//        function RowClick(stationEventID,eventNo,stationEventDesc) //Modify by zengshunbo 2009-01-16 issue 0920
        function RowClick(stationEventID,eventNo)
        {
//            debugger;
             window.dialogArguments.form1.txtHdnRelativeStationEventID.value=stationEventID;
             window.dialogArguments.form1.txtRelativeDesc.value=eventNo;
             window.dialogArguments.form1.txtRelativeDesc.style.cursor="hand";
             close();
        }
 
        function Search_Click(msg)
        {
            if(trim(document.getElementById("txtDays").value)=="")
            {
                alert(msg);
                return false;
            }
        }
        function TrimZero(strval)
        {
            if (strval.substring(0,1)=="0")
              {
                   strval=strval.substr(1);
                   strval=TrimZero(strval);
               }
            return strval;
        }
        
        function IsInteger(val)
        {
	        var re;
	        //re = /^[0-9]*[1-9][0-9]*$/;
	        re = /^[0-9]*$/;
	        return re.exec(val);	        
        }
        
        function CheckCtlNo(obj)
        {
 
          //onkeyup="this.value=this.value.replace(/\D/g,'')" 

          if (obj.value!="")
          {
                if (!IsInteger(obj.value))
                {         
                  obj.value=obj.title;       
                  return false;
                }
                
                if (obj.value.length>=2)
                {
                     obj.value=TrimZero(obj.value);         
                }
                
                if(obj.value=="0")
                {
                    obj.value="";
                    obj.focus();
                    return false;
                }
                 
          
                if (parseInt(obj.value)>32767)
                {    
                      alert(document.getElementById("hideOverFlow").value);
                      obj.value=obj.title;
                      obj.focus();
                      
                      return false;
                }
                else
                {
                      return true;
                }
          }
          else
          {
             return false;
          }
          
        }

        function KeyDown(obj) 
        {     
           //alert(window.event.keyCode);
           
           if(window.event.keyCode==17 || window.event.keyCode==16)//17-Ctrl,16-shift
           {
                //event.keyCode=0;
                return false;		
           }
           
           if((window.event.keyCode==8) || (window.event.keyCode==46) || (window.event.keyCode==37) || (window.event.keyCode==38) || (window.event.keyCode==39) || (window.event.keyCode==40))
           {
              return true;
           }
          
           if((window.event.keyCode>=48 && window.event.keyCode<=57) || (window.event.keyCode>=96 && window.event.keyCode<=105))        
            {              
                return true;
            }
            else
            {	
                event.keyCode=0;
                return false;		    	
            }	
        }
        
    </script>

</head>
<body>
    <form id="form1" runat="server">
         
        <fieldset class="SearchArea">
        
        
            <table width="99%">
                <tr>
                    <td style="width: 108px">
                        <asp:Label ID="lblRelative" runat="server"></asp:Label>
                    </td>
                            <td style="width: 143px">
                                <asp:TextBox ID="txtDays" runat="server" Width="50px" onblur="return CheckCtlNo(this)"  onkeydown="javascript:return KeyDown(this)"  MaxLength="5">30</asp:TextBox><asp:Label id="lblDays" runat="server" Text="Days"></asp:Label>
                            </td>
                            <td align="right">
                                <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" />
                                <asp:Button ID="btnClose" runat="server" />
                                <asp:HiddenField ID="hideOverFlow" runat="server" />
                            </td>
                    </tr>
                </table>
         </fieldset>
         <br />
          <div id="HistoryRecord" runat ="server"  style="height: 80%; width: 97%; overflow: auto; border-style: groove;">
                <table width="99%">
                <tr>
                    <td colspan="3">
                        <APJ:CommonGridView ID="grvData" runat="server" AllowSorting="True" AscPic="~/Images/Common/arrow_up_green.png" AutoGenerateColumns="False" BorderColor="black" CssClass="GridView" DescPic="~/Images/Common/arrow_down_green.png" PageLinkCount="7" OnNeedDataBind="grvData_NeedDataBind" OnRowDataBound="grvData_RowDataBound" AllowPaging="True" DataKeyNames="StationEventID">
                            <EmptyDataRowStyle CssClass="GridView_Header" />
                            <Columns>
                                <asp:BoundField DataField="EventNo" HeaderText="SOM_EventNo" SortExpression="EventNo">
                                    <itemstyle width="20%" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="SOM_EventTime" SortExpression="EventTime">
                                    <edititemtemplate>
<asp:TextBox id="TextBox1" runat="server" Text='<%# Bind("EventTime") %>' __designer:wfdid="w43"></asp:TextBox>
</edititemtemplate>
                                    <itemtemplate>
<asp:Label id="Label1" runat="server" Text='<%# FormatDateTime(Eval("EventTime"),true) %>' __designer:wfdid="w42"></asp:Label>
</itemtemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Description" HeaderText="COM_Description" SortExpression="Description" >
                                    <itemstyle width="50%" />
                                </asp:BoundField>
                            </Columns>
                            <PagerTemplate>
                                <asp:Table ID="CommonPagerTemplate" runat="server" Width="100%">
                                    <asp:TableRow ID="COMGRIDV_TR" runat="server">
                                        <asp:TableCell ID="COMGRIDV_Pager_Cell_TotalRecords" runat="server" CssClass="GridView_Pager_Cell_TotalRecords">
                                            <asp:Label ID="Lbl_T_TotalRecords" runat="server">Total Records:</asp:Label>
                                            <asp:Label ID="Lbl_V_TotalRecords" runat="server"></asp:Label>
                                            &nbsp; &nbsp;
                                            <asp:Label ID="Lbl_V_CurPage" runat="server"></asp:Label>
                                            &nbsp;<asp:Label runat="server">/</asp:Label>
                                            &nbsp;<asp:Label ID="Lbl_V_TotalPages" runat="server"></asp:Label>
                                        </asp:TableCell>
                                        <asp:TableCell ID="COMGRIDV_Pager_Cell_PageSize" runat="server" CssClass="GridView_Pager_Cell_PageSize">
                                            <asp:Label ID="Lbl_T_PageSize" runat="server">PageSize:</asp:Label>
                                            &nbsp;&nbsp;<asp:DropDownList ID="DDL_PageSize" runat="server" AutoPostBack="True">
                                                <asp:ListItem Value="5">5</asp:ListItem>
                                                <asp:ListItem Value="10">10</asp:ListItem>
                                                <asp:ListItem Value="15">15</asp:ListItem>
                                                <asp:ListItem Value="20">20</asp:ListItem>
                                                <asp:ListItem Value="25">25</asp:ListItem>
                                                <asp:ListItem Value="30">30</asp:ListItem>
                                            </asp:DropDownList>
                                        </asp:TableCell>
                                        <asp:TableCell ID="COMGRIDV_Pager_Cell_Prev" runat="server" CssClass="GridView_Pager_Cell_Prev">
                                            <asp:LinkButton ID="LBtn_Previous" runat="server" CommandArgument="Prev" CommandName="Page"><</asp:LinkButton>
                                        </asp:TableCell>
                                        <asp:TableCell ID="COMGRIDV_Pager_Cell_PagerLink" runat="server" CssClass="GridView_Pager_Cell_PagerLink">
                                            <asp:Panel ID="Pnl_PageLink" runat="server" CssClass="GridView_Pager_PageLinkPanel">
                                            </asp:Panel>
                                        </asp:TableCell>
                                        <asp:TableCell ID="COMGRIDV_Pager_Cell_Next" runat="server" CssClass="GridView_Pager_Cell_Next">
                                            <asp:LinkButton ID="LBtn_Next" runat="server" CommandArgument="Next" CommandName="Page">></asp:LinkButton>
                                        </asp:TableCell>
                                    </asp:TableRow>
                                </asp:Table>
                            </PagerTemplate>
                            <RowStyle CssClass="GridView_Row" />
                            <HeaderStyle CssClass="GridView_Header" />
                            <AlternatingRowStyle CssClass="GridView_AlternativeRow" />
                            <EmptyDataTemplate>
                                <asp:Table runat="server" CssClass="GridView_Header_EmptyData">
                                    <asp:TableRow runat="server">
                                        <asp:TableCell runat="server" Style="border-right: black 1px solid;" Width="20%"></asp:TableCell>
                                        <asp:TableCell runat="server"></asp:TableCell>
                                    </asp:TableRow>
                                </asp:Table>
                            </EmptyDataTemplate>
                        </APJ:CommonGridView>
                    </td>
                </tr>
            </table>
        </div>
        <br />
    </form>    
</body>
</html>
